using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using BanHangCshap.Class;
namespace BanHangCshap
{
    public partial class frmChonHangHoaBaoGia : DevExpress.XtraEditors.XtraForm
    {
        public frmChonHangHoaBaoGia()
        {
            InitializeComponent();
        }
        BaoGia cls = new BaoGia();
        public delegate void GetDataTable(DataTable dt);
        public GetDataTable getDataTalbe;
        public DataTable dt;
        public void loadLoaiHang()
        {
            LoaiHang clsloaihang = new LoaiHang();
            rglkuLoaiHang.DataSource = clsloaihang.layDSLoaiHang();
            rglkuLoaiHang.DisplayMember = "tenloai";
            rglkuLoaiHang.ValueMember = "maloai";

        }
        private void frmChonHangHoaBaoGia_Load(object sender, EventArgs e)
        {
            loadLoaiHang();
            grcDanhMucHangHoa.DataSource = dt;
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DataTable data = cls.layDSBaoGiaChiTiet("");
           
            //DataRow row = d.NewRow();
            for (int i = 0; i < grvDanhMucHangHoa.RowCount; i++)
            {
                DataRow dr = grvDanhMucHangHoa.GetDataRow(i);
                
                if (dr["chon"].ToString() == "True")
                {
                    DataRow row = data.NewRow();
                    row[0] = dr["maloai"].ToString();
                    row[1] = dr["mahang"].ToString();
                    row[2] = dr["tenhang"].ToString();
                    row[3] = dr["dvt"].ToString();
                    row[4] = dr["motabg"].ToString();
                    row[5] = dr["dongia"].ToString();
                    row[6] = dr["ghichubg"].ToString();
                    data.Rows.InsertAt(row, data.Rows.Count);
                }
            }
            getDataTalbe(data);
        }
    }
}